import * as actionTypes from "./actionTypes";
import { fromJS } from "immutable"; //把数据转为immutable对象，使用这个使用更要使用gget方法，使用set方法去变更state内容
 
const defaultState = fromJS({
  shoppingCartInfo:{
    deleteAll: false,
    loading: true,
    checkedNum: 0,
    allPrice: 0,
    cartNmu: 0,
    data: []
  }
   
});
// 导出一个纯函数
export default (state = defaultState, action) => {
  switch (action.type) {
    case  actionTypes.GetShoppingCartList:
      return state.set("shoppingCartInfo",fromJS(action.data));
      default:
        return state;
  }
};
